//
//  ComDynamicUI1VC.swift
//  ZYA
//
//  Created by 邱仙凯 on 2024/12/3.
//  Copyright © 2024 zwb. All rights reserved.
//

import UIKit

class ComDynamicUI1VC: ComDynamicBaseVC {
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self .navigationController?.navigationBar.isTranslucent = false
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        collectionView.backgroundColor = .white
        
      configSearch()
    }
    func configSearch() {
       
     
            searchBar!.searchTextField.backgroundColor = UIColor(kshex: "#f5f5f5")
         
            searchBar!.searchTextField.layer.masksToBounds = true
    
        searchBar?.backgroundImage = UIImage()
        
        let toolbar = UIToolbar()
        toolbar.barStyle = UIBarStyle.default
        toolbar.sizeToFit()
        let buttonflexible = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil)
        let buttonDone = UIBarButtonItem(title: "完成", style: UIBarButtonItem.Style.done, target: self, action: #selector(doneClickss))
        buttonDone.tintColor = UIColor.black
        toolbar.setItems([buttonflexible, buttonDone], animated: true)
        
        searchBar!.inputAccessoryView = toolbar
        
        searchBar!.placeholder = "搜索"
       
        
        searchBar!.searchTextField.layer.cornerRadius = 8
        self.searchBar!.frame = CGRect(x:10,y:0,width:KSGlobal.screenW - 20,height:getcolltopMargin())
        let sBg = UIView(frame:CGRect(x:0,y:0,width:KSGlobal.screenW,height:50))
        sBg.addSubview(searchBar!)
        self.view.addSubview(sBg)
     
    }
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
        return UIEdgeInsets(top: 18, left: 24, bottom: 24, right: 24)
  

    }

}
